package com.sf.fy.uav.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sf.fy.uav.common.request.operate.FileAddRequest;
import com.sf.fy.uav.common.utils.BeanUtil;
import com.sf.fy.uav.entity.File;
import com.sf.fy.uav.mapper.FileMapper;
import com.sf.fy.uav.service.IFileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 文件 服务实现类
 * </p>
 *
 * @author LTQ
 * @since 2023-07-03
 */
@Service
public class FileServiceImpl extends ServiceImpl<FileMapper, File> implements IFileService {

    @Autowired
    private FileMapper fileMapper;

    @Override
    public File add(FileAddRequest fileAddRequest) {
        File file = BeanUtil.copyProperties(fileAddRequest, File.class);
        fileMapper.insert(file);
        return file;
    }
}
